package summer_vacation.cullen.four10;

import java.util.Scanner;

/**
 * Created by Cullen on 2015/8/13.
 */
public class N49 {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        int n = 0;
        int[] f = new int[1000];
        for (int i = 0; i < 1000; i++) {
            int temp = cin.nextInt();
            if (temp != -1) {
                n++;
                f[i] = temp;
            } else break;
        }
        System.out.println("原来的数组：");
        for (int j = 0; j < n; j++) {
            System.out.print(f[j] + " ");
        }
        System.out.print("\n");
        int max = f[0];
        int xiabiao = 0;
        for (int j = 1; j < n; j++) {
            if (f[j] > max) {
                max = f[j];
                xiabiao = j;
            }
        }
        System.out.print("最大值：" + max + "，下标：" + xiabiao + "\n");
        int h = f[0];
        f[0] = max;
        f[xiabiao] = h;
        System.out.println("结果数组：");
        for (int j = 0; j < n; j++) {
            System.out.print(f[j] + " ");

        }
    }
}
